﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Supports.aspx.cs" Inherits="PmSadis.WebFormsUi.Administrator.Supports" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%--<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
</asp:Content>--%>
<asp:Content ID="supportContent" ContentPlaceHolderID="content" runat="server">
    <link href="../Content/admin.support.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function gvSupportSelectionChanged(s, e) {
            var selectedCount = s.GetSelectedRowCount();
            var btnEnabled = selectedCount > 0;
            btnDelete.SetEnabled(btnEnabled);
            btnOnControl.SetEnabled(btnEnabled);
            btnComplete.SetEnabled(btnEnabled);
            btnCancelAll.SetEnabled(btnEnabled);
        }

        function selectAllOnpage(s, e) {
            var checked = s.GetValue();
            if (checked)
                gvSupport.SelectAllRowsOnPage();
            else
                gvSupport.UnselectRows();
        }
    </script>
    <style type="text/css">
        .btn-group
        {
            display:inline-block;
            width:100%;
            margin:10px 0;
        }
        .btn-group>table
        {
            float:left;
        }
    </style>
    <h2>
        Техподдержка</h2>
    <asp:ScriptManager ID="supportsScriptManager" runat="server" />
    <!--units data source-->
    <asp:ObjectDataSource ID="dsSupports" runat="server" TypeName="PmSadis.WebFormsUi.Administrator.Supports"
        SelectMethod="GetAll" DeleteMethod="DeleteSupport" />
    <asp:UpdatePanel ID="supportsUpdatePanel" runat="server">
        <ContentTemplate>
            <div class="btn-group">
                <dx:ASPxButton ID="btnDelete" runat="server" Image-Url="~/Content/Images/Buttons/btnDelImage.gif"
                    Text="Удалить" ClientEnabled="false" ClientInstanceName="btnDelete" OnClick="btnDelete_Click" />
                    <dx:ASPxButton ID="btnOnControl" runat="server" ClientInstanceName="btnOnControl" ClientEnabled="false" Text="На контроль" Image-Url="~/Content/Images/Buttons/btnOnControlSupportImage.png" OnClick="btnOnControl_Click" />
                    <dx:ASPxButton ID="btnComplete" runat="server" ClientInstanceName="btnComplete" ClientEnabled="false" Text="Завершить" Image-Url="~/Content/Images/Buttons/btnCompleteSupportImage.png" OnClick="btnOnComplete_Click" />
                    <dx:ASPxButton ID="btnCancelAll" runat="server" ClientInstanceName="btnCancelAll" ClientEnabled="false" Text="Сбросить" Image-Url="~/Content/Images/Buttons/btnCancelAllSupportImage.png" OnClick="btnCancelAll_Click" />
            </div>
            <dx:ASPxGridView ID="gvSupport" runat="server" DataSourceID="dsSupports"
                KeyFieldName="SupportId" ClientInstanceName="gvSupport" OnHtmlRowPrepared="gvSupport_HtmlRowPrepared">
                <ClientSideEvents SelectionChanged="gvSupportSelectionChanged" />
                <Columns>
                    <dx:GridViewDataColumn FieldName="SupportId" Visible="false" />
                    <dx:GridViewCommandColumn ShowSelectCheckbox="true">
                        <HeaderCaptionTemplate>
                            <dx:ASPxCheckBox ID="chbSelectAll" runat="server" ClientSideEvents-CheckedChanged="selectAllOnpage" />
                        </HeaderCaptionTemplate>
                    </dx:GridViewCommandColumn>
                    <dx:GridViewDataDateColumn FieldName="DateCreate" Caption="Дата создания">
                        <PropertiesDateEdit DisplayFormatString="dd-MM-yyyy HH:mm" />
                    </dx:GridViewDataDateColumn>
                    <dx:GridViewDataTextColumn FieldName="Title" Caption="Заголовок сообщения" />
                    <dx:GridViewDataTextColumn FieldName="Content" Caption="Содержание сообщения" />
                    <dx:GridViewDataComboBoxColumn Caption="Статус" FieldName="Status">
                        <PropertiesComboBox ValueType="System.Int32">
                            <Items>
                                <dx:ListEditItem Text="В рассмотрении" Value="0" />
                                <dx:ListEditItem Text="На контроле" Value="1" />
                                <dx:ListEditItem Text="Завершено" Value="2" />
                            </Items>
                        </PropertiesComboBox>
                    </dx:GridViewDataComboBoxColumn>
                </Columns>
            </dx:ASPxGridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
